
import requests
from bs4 import BeautifulSoup
import lxml

url = 'https://www.xingpaibilliard.com/category/news/ssxw'
response = requests.get(url,headers={
    "user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/000000000 Safari/537.36 Edg/000000000",
})
# print(response.status_code)
# if response.status_code == 200:
#     print(response.text)
soup = BeautifulSoup(response.text,'lxml')

divs = soup.find_all('div', class_='item-content')
for div in divs:
    h2 = div.find('h2')
    span = div.find('span')
    print(f"时间：{span.text.strip()}, 标题:{h2.text.strip()}")


# titles = soup.find_all('h2',class_='item-title')
# for title in titles:
#     print(title.text.strip())




